<template>
  <div>
    <header-title :header-title="title" />
    <order-form @on-success-valid="handleSubmit" />
    <refund-manage-dialog
      :row="row"
      :dialog-visible="manageVisible"
      @cancel-dialog="handleCancelManageDialog"
      @confirm-dialog="handleConfirmManageDialog"
    />
    <confirm-dialog
      :dialog-visible="confirmVisible"
      @cancel-dialog="handleCancel"
      @confirm-dialog="handleConfirm"
    />
    <page-table
      :table-data="OrderTableData()"
      :page-title="title"
      @handle-click="handleDepature"
    />
    <pagination
      :total="OrderDataCount()"
      @click-page="handleClickPage"
      @change-pagesize="handleSizeChange"
    />
  </div>
</template>
<script>
import HeaderTitle from '@/components/HeaderTitle'
import PageTable from '@/components/PageTable'
import Pagination from '@/components/Pagination'
import RefundManageDialog from '@/components/RefundManageDialog'
import ConfirmDialog from '@/components/ConfirmDialog'
import OrderForm from '@/components/OrderForm'
import mixin from '@/mixin/mixin'
export default {
  components: {
    HeaderTitle,
    PageTable,
    RefundManageDialog,
    OrderForm,
    ConfirmDialog,
    Pagination
  },
  mixins: [mixin],
  data() {
    return {
      title: '待退押金',
      manageVisible: false,
      confirmVisible: false,
      row: {}
    }
  },
  mounted() {
    this.getOrderData({})
  },
  methods: {
    handleSubmit(playload) {
      console.log(playload)
    },
    handleDepature(row) {
      console.log(row)
      let newRow = {}
      if (row.id) {
        newRow = { ...row }
      }
      this.row = newRow
      this.manageVisible = true
    },
    handleCancelManageDialog() {
      this.manageVisible = false
    },
    handleConfirmManageDialog() {
      this.confirmVisible = true
      this.manageVisible = false
    },
    handleCancel() {
      this.confirmVisible = false
      this.manageVisible = true
    },
    handleConfirm() {
      this.confirmVisible = false
    },
    handleClickPage(page) {
      console.log(page)
    },
    handleSizeChange(pagesize) {
      console.log(pagesize)
    }
  }
}
</script>

